﻿using Compass.Wasm.Shared.Categories;

namespace Compass.Wasm.Shared.Wms;

//物料
public class CargoDto : BaseDto
{
    private string mtlNumber;//物料编码
    public string MtlNumber { get => mtlNumber; set { mtlNumber=value; OnPropertyChanged(); } }

    private string? description;
    public string? Description
    {
        get => description;
        set { description = value; OnPropertyChanged(); }
    }//中文描述/产品编号

    private string? enDescription;
    public string? EnDescription
    {
        get => enDescription;
        set { enDescription = value; OnPropertyChanged(); }
    }//英文描述


    private Unit_e unit;//计量单位
    public Unit_e Unit { get => unit; set { unit=value; OnPropertyChanged(); } }//PCS

    private Sbu_e sbu;
    public Sbu_e Sbu { get => sbu; set { sbu=value; OnPropertyChanged(); } }//FS

    //大类
    private Group_e group;
    public Group_e Group { get => group; set { group = value; OnPropertyChanged(); } }

    //是否为消耗件
    private bool consumable;
    public bool Consumable { get => consumable; set { consumable = value; OnPropertyChanged(); } }

    private bool inspection;//来料检验
    public bool Inspection { get => inspection; set { inspection = value; OnPropertyChanged(); } }

    //Row =Location==null? "0": Location.Split('-')[2];
    private string? location;//库位编号
    public string? Location { get => location; set { location = value; OnPropertyChanged(); } }

    private double safetyStock;//安全库存
    public double SafetyStock { get => safetyStock; set { safetyStock=value; OnPropertyChanged(); } }

    private OrderingWay_e orderingWay;//订货方法
    public OrderingWay_e OrderingWay { get => orderingWay; set { orderingWay=value; OnPropertyChanged(); } }

    private int leadTime;//采购周期-->采购提前期，可以根据采购订单时间和收货时间计算获得，也可以手动修改
    public int LeadTime { get => leadTime; set { leadTime=value; OnPropertyChanged(); } }

    private double minimalBatch;//最小批量
    public double MinimalBatch { get => minimalBatch; set { minimalBatch=value; OnPropertyChanged(); } }

    private string? vendors;//供应商
    public string? Vendors { get => vendors; set { vendors = value; OnPropertyChanged(); } }

    private double lastPrice;//最新价格
    public double LastPrice { get => lastPrice; set { lastPrice=value; OnPropertyChanged(); } }

    private double avgPrice;//平均价格（近1年?）
    public double AvgPrice { get => avgPrice; set { avgPrice=value; OnPropertyChanged(); } }

    private string? remarks;//备注
    public string? Remarks { get => remarks; set { remarks = value; OnPropertyChanged(); } }

    private string? imageUrl;//图片
    public string? ImageUrl { get => imageUrl; set { imageUrl = value; OnPropertyChanged(); } }

    //todo:计算MTPT物料周转率=Math.Round(30*库存金额/消耗金额)


    #region 额外属性1，库存
    //实际库存=期初库存+在途库存+入库库存-出库数量
    //在途库存
    //总库存：实际库存+在途库存

    //期初数量：盘点单中某个物料的最新一条记录，盘点日期
    //在途数量：盘点日期后的每一个入库记录中的（采购数量-入库数量）之和
    //入库数量：盘点日期后的每一个入库记录中的入库数量之和
    //出库数量：盘点日期后的每一个出库记录中的出库数量之和
    //库存
    private double inventory;
    public double Inventory { get => inventory; set { inventory=value; OnPropertyChanged(); } }
    //在途数量
    private double transitIn;
    public double TransitIn { get => transitIn; set { transitIn=value; OnPropertyChanged(); } }
    //待领料数量
    private double transitOut;
    public double TransitOut { get => transitIn; set { transitIn=value; OnPropertyChanged(); } }
    //库存紧缺
    private bool shortAge;
    public bool ShortAge { get => shortAge; set { shortAge=value; OnPropertyChanged(); } }

    private double inventoryValue;
    public double InventoryValue { get => inventoryValue; set { inventoryValue=value; OnPropertyChanged(); } }

    #endregion

    #region 额外属性2，是否被选中
    private bool isSelected;
    public bool IsSelected { get => isSelected; set { isSelected = value; OnPropertyChanged(); } }
    #endregion
}